package com.kehutong.user.dao;

import org.coraframework.orm.annotation.Dao;
import org.coraframework.orm.annotation.Mapper;
import org.coraframework.orm.jdbc.Page;
import org.coraframework.orm.jdbc.execute.Condition;

import java.util.HashMap;
import java.util.Map;

@Dao
public interface ParkingUserDao {

    @Mapper(
            genericType = HashMap.class,
            countSQL = "select COUNT(1) FROM  " +
                    " (SELECT  " +
                    "  DISTINCT  " +
                    " a.id,  " +
                    " a.realname,  " +
                    " a.mobile,  " +
                    " b.ownerNo," +
                    " b.communityNo,  " +
                    " b.communityName,  " +
                    " a.createTime  " +
                    " FROM  " +
                    " t_resident a,  " +
                    " t_resident_house b  " +
                    " WHERE  " +
                    " 1 = 1  " +
                    " AND a.id = b.residentNo  " +
                    " And b.houseType='3'" +
                    " AND b.bindType IN('0','1')  " +
                    " AND b.deleted = FALSE  " +
                    " AND ${}) t",
            sql = "SELECT" +
                    "  DISTINCT" +
                    "  a.id," +
                    "  a.realname," +
                    "  a.mobile," +
                    "  b.ownerNo," +
                    "  b.communityNo," +
                    "  b.communityName," +
                    "  a.createTime" +
                    " FROM" +
                    " t_resident a," +
                    " t_resident_house b" +
                    " WHERE" +
                    " 1 = 1" +
                    " AND a.id = b.residentNo" +
                    " And b.houseType='3'" +
                    " AND b.bindType IN('0','1')" +
                    " AND b.deleted = FALSE" +
                    " AND ${}"
    )
    public Page<Map<String, Object>> loadPage(Condition... condition);
}
